Description
Logical semaphores (LSMs) contain a single signed integer which can be modified by signalers. Consumers can specify keys and rules. For example, the consumer may wish to block until the semaphore value exceeds 24, or is equal to 15 and so on. These objects are primarily provided as a means of providing switching and routing logic (equivalent to conditional branching). Before reading this topic, we would recommend familiarity with Manual Connections and Logical Semaphores.
The condition that is applied to the semaphore's existing value depends on the 'rule'. If the condition evaluates to TRUE, or becomes TRUE as the result of a signal, then the requester will unblock. The following rules/conditions are supported;
CLP_EQ_RULE
(value == key1)
CLP_NE_RULE
(value != key1)
CLP_GT_RULE
(value > key1)
CLP_GE_RULE
(value >= key1)
CLP_LT_RULE
(value < key1)
CLP_LE_RULE
(value <= key1)
CLP_RANGE_RULE
((value >= key1) && (value <= key2))
CLP_AND_RULE
(value & key1)
CLP_MOD_RULE
((value % key2) == key1)
Prototype
Uns Request( Int key1,
Int key2,
Uns rule,
Uns timeout );
Parameters
key1
First request key (see description above)
key2
Second request key (see description above)
rule
Request rule (see description above)
timeout
This parameter determines whether the connection will poll or block (see Connection Timeout). It can be set to poll (CLP_POLL), block (CLP_WAIT) or a millisecond timeout.
Return Value
This function returns logical TRUE if the condition becomes TRUE within the specified timeout period, or FALSE otherwise.